<template>
  <div class="manage">
    <Header title="系统监控"></Header>
    <div class="item" v-for="(item, index) in systemWatchState" :key="index">
      <img src="./../../../assets/icons/wifi (4).png" alt="" v-if="item.systmestate===1">
      <img src="./../../../assets/icons/wifi (5).png" alt="" v-else>
      <p>{{item.systmestate=== 0 ? '正常' : '异常'}}</p>
      <p class="text">{{item.systmename}}</p>
    </div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
</template>

<script>
import Header from '../../../components/Header/Header'
import { getSystemWatch } from '../../../api'

export default {
  name: 'Manage',
  data () {
    return {
      // 系统监控状态数组
      systemWatchState: []
    }
  },
  mounted () {
    // 获取系统监控状态
    this.getSystemWatchState()
  },
  components: {
    Header
  },
  methods: {
    async getSystemWatchState () {
      const result = await getSystemWatch()
      this.systemWatchState = result.data
      // console.log(this.systemWatchState)
    }
  }
}
</script>

<style scoped lang="less">
  .manage {
    width: 100%;
    height: calc(-45px + 100%);
    letter-spacing: 1px;

    .item {
      width: 50%;
      height: 25%;
      float: left;
      text-align: center;
      color: #464d54;

      img {
        width: 44px;
        height: 44px;
        margin-top: 30px;
        margin-bottom: 10px;
      }

      .text {
        margin-top: 24px;
        font-size: 18px;
      }

      border-bottom: 1px solid #cccccc;

      &:nth-child(even) {
        border-right: 1px solid #cccccc;
      }
    }
  }
</style>
